package com.example.treehole.activity;

import android.annotation.SuppressLint;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.example.treehole.LoginActivity;
import com.example.treehole.R;
import com.google.android.material.snackbar.Snackbar;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

public class SettingActivity extends BaseActivity {

    @BindView(R.id.tv_head_line)
    TextView tvHeadLine;

    @Override
    protected int initLayout() {
        return R.layout.activity_setting;
    }

    @Override
    protected void initData() {
        tvHeadLine.setText(getString(R.string.setting));
    }

    @SuppressLint("NonConstantResourceId")
    @OnClick({R.id.iv_exit, R.id.rl_edit, R.id.rl_about_us, R.id.rl_exit_login})
    public void onClick(View view) {

        switch (view.getId()) {
            case R.id.iv_exit:
                finish();
                break;
            case R.id.rl_edit:
                jumpTo(EditInfoActivity.class);
                break;
            case R.id.rl_about_us:
                jumpTo(AboutActivity.class);
                break;
            case R.id.rl_exit_login:
                Snackbar snackbar=Snackbar.make(findViewById(R.id.coo_layout), "确定退出登录？", Snackbar.LENGTH_LONG);
                View view1=snackbar.getView();
                //view1.getLayoutParams().height=180;
                snackbar.setAction("确定", new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                saveStringToSp("isLogin","false");
                                jumpTo(LoginActivity.class);
                                finishAndRemoveTask();
                            }
                        }).show();
                break;
        }
    }

}